<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>BatteryCharger: Main Page</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">BatteryCharger
   &#160;<span id="projectnumber">5.0</span>
   </div>
   <div id="projectbrief">A smart charger for lead-acid batteries.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li class="current"><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('index.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">BatteryCharger Documentation</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><dl class="section author"><dt>Author</dt><dd>K. Joseph Hass </dd></dl>
<dl class="section date"><dt>Date</dt><dd>Created: 2014-01-03T15:46:24-0500 </dd>
<dd>
Last modified: 2014-01-12T13:20:33-0500</dd></dl>
<dl class="section copyright"><dt>Copyright</dt><dd>Copyright (C) 2014 Kenneth Joseph Hass</dd>
<dd>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.</dd>
<dd>
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.</dd></dl>
<h1><a class="anchor" id="intro"></a>
Introduction</h1>
<p>This microcontroller-based battery charger is a prototype for a high-voltage charger that will be used with an experimental electric truck. The prototype was designed to charge a standard 12-volt lead-acid battery, but the voltage and current values are easily changed to support other batteries.</p>
<p>Important features of the charger include:</p>
<ul>
<li>Three-stage operation to quickly and safely recharge the battery</li>
<li>Pulse-width modulation control of power electronics</li>
<li>LCD character display of charging mode, voltage, current, and temperature</li>
<li>Checks for presence of battery before charging begins</li>
<li>ARM Cortex-M0 microcontroller (NXP LPC1114)</li>
</ul>
<h1><a class="anchor" id="charging"></a>
Three-stage charging</h1>
<p>A 3-stage charging cycle is used to charge the battery as quickly as possible without sacrificing safety or battery life. In the first stage, the charger provides a constant current to the battery. For the prototype software this current is set to 1.8 A. The current sensing circuitry in the prototype can measure currents up to about 3.3 A, so it can support higher charging currents. The constant-current charging in the first stage continues until the battery voltage reaches 2.4 V per cell, or 14.4 V for a standard 12 V battery.</p>
<p>Once the battery voltage reaches 14.4 V the charger enters the second charging stage, which is constant-voltage charging at 2.4 V per cell. As the battery reaches a fully charged condition the charging current will begin to decrease. When the charging current falls below 0.1 A the battery is assumed to be fully charged.</p>
<p>The third charging stage, trickle charging, is entered when the charging current falls below 0.1 A during the second, constant-voltage, stage. The charger continues to operate in a constant-voltage mode but the charging voltage is reduced to a lower voltage. This stage is intended to safely maintain the battery in its fully-charged condition, and the battery can be charged indefinitely at this voltage.</p>
<h1><a class="anchor" id="operation"></a>
Charger operation</h1>
<dl class="section note"><dt>Note</dt><dd>Pressing the <b>STOP</b> button at any time will disable the PWM signal (i.e. set it to a constant logic 0) and return the charger to its initial state.</dd>
<dd>
The user should always press the <b>STOP</b> button before connecting or disconnecting the battery.</dd></dl>
<h2><a class="anchor" id="normalop"></a>
Normal charging</h2>
<p>The prototype charger is powered from a laptop battery charger that provides 19 V with a maximum current of over 4 A. The charger itself should be powered before it is connected to a battery. When power is first applied to the charger (or when the <b>STOP</b> button is pressed) the LCD will present this message: </p>
<pre class="fragment">Press button to
  start charging
</pre><p>The charger waits until the <b>START</b> is pressed, and then checks the voltage at the battery terminals to determine if a suitable battery has been connected. If the measured voltage is less than the value specified by <a class="el" href="charger_8h.html#a155b9d569ca9278041cbc9692ef10107">SHORT_VOLTAGE_MV</a> (currently 11.0 V) then the charger halts and displays this message: </p>
<pre class="fragment">Charging stopped
Short/no battery
</pre><p>If the measured voltage is greater than the value specified by <a class="el" href="charger_8h.html#a6dc1bd0a4ebfb54241782dc63ac3ec9b">OPEN_VOLTAGE_MV</a> (currently 15.0 V) the charger will halt with this message: </p>
<pre class="fragment">Charging stopped
Open, no battery
</pre><p>Once the charger has halted the user must press the <b>STOP</b> button to reset the microcontroller.</p>
<p>If the initial voltage at the battery terminal is between the limits specified by <a class="el" href="charger_8h.html#a155b9d569ca9278041cbc9692ef10107">SHORT_VOLTAGE_MV</a> and <a class="el" href="charger_8h.html#a6dc1bd0a4ebfb54241782dc63ac3ec9b">OPEN_VOLTAGE_MV</a> then the charger enters the first stage of charging and displays: </p>
<pre class="fragment">Constant Current
00.0V 0.0A  00 C
</pre><p>where the zeros are replaced with the measured values of voltage, current, and temperature. The duty cycle of the PWM signal is increased slowly until the desired current level is reached, as specified by <a class="el" href="charger_8h.html#a75719826231baaded30955287d81da29">MODE1_CURRENT_MA</a> (currently 1.8 A). The charger then maintains the charging current at that level until the battery voltage rises to <a class="el" href="charger_8h.html#acc1654433c4c1af7ad32859fc0ebb318">MODE1_VOLTAGE_MV</a> (currently 14.4 V), and at that point the charger transitions to the second, constant-voltage, stage of charging.</p>
<p>In the second stage the PWM duty cycle will be increased or decreased as necessary to maintain the battery voltage at <a class="el" href="charger_8h.html#a3dbda1866df5cd0bc16fab99924bdb5d">MODE2_VOLTAGE_MV</a> (currently 14.4 V) and the charger displays: </p>
<pre class="fragment">Constant Voltage
00.0V 0.0A  00 C
</pre><p>Under normal circumstances the charging current (and thus the PWM duty cycle) will gradually decrease as the battery reaches a fully charged state. When the current falls to the level specified by <a class="el" href="charger_8h.html#a9fac06211d62c1a2967d00a6e50c54c1">MODE2_CURRENT_MA</a> (currently 0.1 A) then the charger transitions to the third and final charging stage.</p>
<p>The third stage is also constant-voltage charging but the voltage is reduced to a level that can be safely applied to the battery indefinitely. This voltage is specified by <a class="el" href="charger_8h.html#a653480f2af346947a14055dbddb464f5">MODE3_VOLTAGE_MV</a> (currently 12.9 V). The charger displays: </p>
<pre class="fragment">Trickle Charge
00.0V 0.0A  00 C
</pre><p>The charger will remain in the trickle charge stage until the <b>STOP</b> button is pressed.</p>
<h2><a class="anchor" id="calop"></a>
Calibration mode</h2>
<p>If the <b>STOP</b> button is held down while the <b>START</b> button is pressed and released then the charger enters a calibration mode of operation. The PWM output is disabled but the charger continues to measure the voltage at the battery terminals. In this mode, the accuracy of the charger's voltage readings can be determined by replacing the battery with an accurate voltage source. The charger displays: </p>
<pre class="fragment">Calibration Mode
00.0V</pre> </div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated on Mon Jan 13 2014 08:36:57 for BatteryCharger by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6 </li>
  </ul>
</div>
</body>
</html>
